/**
 * Licensee: DuKe TeAm
 * License Type: Purchased
 */
package ormsamples;

import org.orm.*;
public class RetrieveAndUpdatePruebaPDS1Data {
	public void retrieveAndUpdateTestData() throws PersistentException {
		PersistentTransaction t = orm.PruebaPDS1PersistentManager.instance().getSession().beginTransaction();
		try {
			orm.DAOFactory lDAOFactory = orm.DAOFactory.getDAOFactory();
			orm.dao.Tda_tipoGasolinaDAO lormTda_tipoGasolinaDAO = lDAOFactory.getTda_tipoGasolinaDAO();
			orm.Tda_tipoGasolina lormTda_tipoGasolina = lormTda_tipoGasolinaDAO.loadTda_tipoGasolinaByQuery(null, null);
			// Update the properties of the persistent object
			lormTda_tipoGasolinaDAO.save(lormTda_tipoGasolina);
			orm.dao.Tdp_precioDAO lormTdp_precioDAO = lDAOFactory.getTdp_precioDAO();
			orm.Tdp_precio lormTdp_precio = lormTdp_precioDAO.loadTdp_precioByQuery(null, null);
			// Update the properties of the persistent object
			lormTdp_precioDAO.save(lormTdp_precio);
			orm.dao.Tcl_logDAO lormTcl_logDAO = lDAOFactory.getTcl_logDAO();
			orm.Tcl_log lormTcl_log = lormTcl_logDAO.loadTcl_logByQuery(null, null);
			// Update the properties of the persistent object
			lormTcl_logDAO.save(lormTcl_log);
			t.commit();
		}
		catch (Exception e) {
			t.rollback();
		}
		
	}
	
	public void retrieveByCriteria() throws PersistentException {
		System.out.println("Retrieving Tda_tipoGasolina by Tda_tipoGasolinaCriteria");
		orm.Tda_tipoGasolinaCriteria tda_tipoGasolinaCriteria = new orm.Tda_tipoGasolinaCriteria();
		// Please uncomment the follow line and fill in parameter(s)
		//tda_tipoGasolinaCriteria.tga_id.eq();
		System.out.println(tda_tipoGasolinaCriteria.uniqueTda_tipoGasolina());
		
		System.out.println("Retrieving Tdp_precio by Tdp_precioCriteria");
		orm.Tdp_precioCriteria tdp_precioCriteria = new orm.Tdp_precioCriteria();
		// Please uncomment the follow line and fill in parameter(s)
		//tdp_precioCriteria.pre_id.eq();
		System.out.println(tdp_precioCriteria.uniqueTdp_precio());
		
		System.out.println("Retrieving Tcl_log by Tcl_logCriteria");
		orm.Tcl_logCriteria tcl_logCriteria = new orm.Tcl_logCriteria();
		// Please uncomment the follow line and fill in parameter(s)
		//tcl_logCriteria.log_id.eq();
		System.out.println(tcl_logCriteria.uniqueTcl_log());
		
	}
	
	
	public static void main(String[] args) {
		try {
			RetrieveAndUpdatePruebaPDS1Data retrieveAndUpdatePruebaPDS1Data = new RetrieveAndUpdatePruebaPDS1Data();
			try {
				retrieveAndUpdatePruebaPDS1Data.retrieveAndUpdateTestData();
				//retrieveAndUpdatePruebaPDS1Data.retrieveByCriteria();
			}
			finally {
				orm.PruebaPDS1PersistentManager.instance().disposePersistentManager();
			}
		}
		catch (Exception e) {
			e.printStackTrace();
		}
	}
}
